< Prev(J) / Next(K) > / View :

Filename: /text/sbasic/shared/03120307.xhp

(section: right) (bookmark: bm_id3153311)
Right function

Right 関数

Right Function [Runtime]
Right 関数 [実行時](hd_id3153311.1)

Returns the rightmost "n" characters of a string expression.
文字列表式の右側「n」文字を取得して返します。(par_id3150984.2)

(/section: right)

See also: Left Function.
次も参照してください:Left 関数(par_id3149763.3)

Syntax:
構文:(hd_id3145315.4)

Right (Text As String, n As Long)
Right (Text As String, n As Integer)(par_id3153061.5)

Return value:
戻り値:(hd_id3145068.6)

String
文字列(par_id3156344.7)

Parameters:
パラメータ:(hd_id3146795.8)

Text: Any string expression that you want to return the rightmost characters of.
Text: 右側の文字を取得する文字列表式。(par_id3153526.9)

n: Numeric expression that defines the number of characters that you want to return. If n = 0, a zero-length string is returned. The maximum allowed value is 65535.
n: 取得する文字の数を指定する整数表式。n にゼロを指定すると、文字長ゼロの空白文字列が返されます。(par_id3151211.10)

The following example converts a date in YYYY-MM-DD format to the US date format (MM/DD/YYYY).
下記の例では YYYY-MM-DD 形式の日付を、アメリカで用いられている形式 (MM/DD/YYYY) に変換します。(par_id3158410.11)

(embed text/sbasic/shared/00000003.xhp#errorcode : linkinfo)

Error Codes

エラーコード(hd_id3152869.37)

(/embed text/sbasic/shared/00000003.xhp#errorcode)

(embed text/sbasic/shared/00000003.xhp#err5 : linkinfo)

5 Invalid procedure call
5 無効なプロシージャー呼び出しです (par_id3150891.41)

(/embed text/sbasic/shared/00000003.xhp#err5)

Example:
例:(hd_id3156212.12)

Sub ExampleUSDate
Sub ExampleUSDate(par_id3150869.13)

Dim sInput As String
Dim sInput As String(par_id3153105.14)

Dim sUS_date As String
Dim sUS_date As String(par_id3154124.15)

sInput = InputBox("Please input a date in the international format 'YYYY-MM-DD'")
sInput = InputBox("Please input a date in the international format 'YYYY-MM-DD'")(par_id3159252.16)

sUS_date = Mid(sInput, 6, 2)
sUS_date = Mid(sInput, 6, 2)(par_id3149561.17)

sUS_date = sUS_date & "/"
sUS_date = sUS_date & "/"(par_id3146984.18)

sUS_date = sUS_date & Right(sInput, 2)
sUS_date = sUS_date & Right(sInput, 2)(par_id3155308.19)

sUS_date = sUS_date & "/"
sUS_date = sUS_date & "/"(par_id3153727.20)

sUS_date = sUS_date & Left(sInput, 4)
sUS_date = sUS_date & Left(sInput, 4)(par_id3145365.21)

MsgBox sUS_date
MsgBox sUS_date(par_id3152940.22)

End Sub
End Sub(par_id3146120.23)


< Prev / Next >